package com.helloworld.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class HttpResponse {
    public static final int SUC = 200;
    public static final int COMMON_FAIL = 500;

    private int code;

    private String msg;

    private Object data;


    public static HttpResponse suc(Object data){
        HttpResponse response = new HttpResponse(SUC, "success!", data);
        return response;
    }
    public static HttpResponse fail(int code, String msg){
        HttpResponse response = new HttpResponse(code, msg, null);
        return response;
    }
    public static HttpResponse fail(String msg){
        return fail(COMMON_FAIL, msg);
    }
}
